package com.aaa.depression.service;

import com.aaa.depression.dao.DepressionTestPlanDao;
import com.aaa.pojo.Page;
import com.aaa.pojo.Plan;
import com.aaa.pojo.ResultBean;
import com.aaa.pojo.question_fpa;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DepressionTestPlanServiceImpl implements DepressionTestPlanService{
    @Autowired
    private DepressionTestPlanDao depressionTestPlanDao;
    @Override
    public ResultBean findAlltest(Page page , Plan plan){
        PageHelper.startPage(page.getPage(), page.getLimit());

        //查数据

        List<Plan> list = depressionTestPlanDao.findAlltest(plan);

        /* System.out.println("data"+list);*/

        PageInfo<Plan> pageInfo=new PageInfo<Plan>(list);

        return new ResultBean(0,"查询成功",pageInfo.getTotal(),pageInfo.getList());

    }

    @Override
    public Integer delete(@Param("id") Integer id) {
        return depressionTestPlanDao.delete(id);
    }

    @Override
    public Integer deletes(@Param("id") Integer[] id) {
        return depressionTestPlanDao.deletes(id);
    }

    @Override
    public Integer save(Plan plan) {
        return depressionTestPlanDao.save(plan);
    }

    @Override
    public Integer update(Plan plan) {
        return depressionTestPlanDao.update(plan);
    }
}
